< previous page page_429 next page >

Page 429
Next, add the GraphSave method code from Listing 11.12 to the project. This code prompts the user for a filename and saves the current graph under that filename.
Type.gifListing 11.12. Coding the GraphSave method.
Public Sub GraphSave()
    '
    ' save graph to disk file
    '
    Dim strFileName As String
    '
    CommonDialog1.DefaultExt = ".bmp"
    CommonDialog1.DialogTitle = "Save Graph"
    CommonDialog1.Filter = "Bitmap Files | *.bmp"
    CommonDialog1.ShowSave
    strFileName = CommonDialog1.filename
    '
    If Trim(strFileName) <> "" Then
        Graph1.DrawMode = gphBlit
        Graph1.ImageFile = strFileName
        Graph1.DrawMode = gphWrite
        Graph1.DrawMode = gphDraw
    End If
    '
End Sub
That's all the code you need for the form. Save this form now. Next, you create the routine that calls this form.
Building the DataGraph Class Object
In order to display the form you just created, you need to create a class object that allows users to set some properties and executes a ShowGraph method. The basic properties of the DataGraph object are
· GraphType: The initial graph type for the display.
· DatabaseName: The official name of the database that contains the records to graph.
· SQLSelect: The SQL SELECT statement that creates the Recordset to display.
· GraphField: The name of the column in the Recordset that contains the values you load into the GraphData property of the graph control.
· GraphTitle: The title of the graph.

 
< previous page page_429 next page >

If you like this book, buy it!